/**
 * This file is Copyright © 2008 Software Craftsmen Limited. All Rights Reserved.
 */
package com.softwarecraftsmen.cachecontrol;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.softwarecraftsmen.functors.NullaryFunctor;
import com.softwarecraftsmen.functors.UnaryFunctor;
import com.softwarecraftsmen.functors.NullaryReturningFunctor;
import com.softwarecraftsmen.functors.UnaryReturningFunctor;

public interface Item<V>
{
	boolean isEmpty();

	boolean hasValue();

	public abstract @Nullable V value();

	public abstract @NotNull Item<V> replace(@NotNull final V value);

	// Consider linking to JAggregate here...
	void isEmpty(@NotNull final NullaryFunctor closure);

	void hasValue(@NotNull final UnaryFunctor<V> closure);

	void ternary(@NotNull final UnaryFunctor<V> trueClosure, @NotNull final NullaryFunctor falseClosure);

	@NotNull <T> T ternary(@NotNull final UnaryReturningFunctor<V, T> trueClosure, @NotNull final NullaryReturningFunctor<T> falseClosure);

}
